<template>
  <div class="h-600px">
    <div :style="cardStyle">{{ joke }}</div>
    <div class="absolute bottom-10 mxa w-100% text-center">
      <button class="u-button mxa" :style="buttonStyle" size="small" shape="circle">
        <view class="px5">{{ buttonText }}</view>
      </button>
    </div>
  </div>
</template>

<script>
import { getJoke } from '@/api/config.js'

export default {
  name: 'DkAppJoke',
  props: {
    buttonText: { type: String, default: '下一个' },
    fileName: { type: String, default: 'xiaohua.json' },
    buttonAdText: { type: String, default: '看广告解锁下一个' },
    pageSize: { type: Number, default: 5 },
    cardStyle: {
      type: Object,
      default: () => {
        return {}
      }
    },
    buttonStyle: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      btnClick: false,
      number: 0,
      joke: '',
      data: []
    }
  },

  watch: {
    fileName() {
      this.getJoke()
    }
  },
  mounted() {
    this.getJoke()
  },
  methods: {
    getJoke() {
      getJoke(this.fileName).then((res) => {
        this.joke = res.data[0]
      })
    }
  }
}
</script>

<style scoped>
.u-button {
  font-size: 12px;
  box-sizing: border-box;
  margin: 0;
  color: #fff;
  border: none;
}
</style>
